package com.yimu.lib.Receiver;



import com.yimu.lib.util.GsonUtil;
import com.yimu.lib.util.MyLogger;



/**
 * 描述：广播NotifyHandler
 * 创建者：  Churck
 * 创建时间：16/7/7 15:56
 * 修改者： Churck
 * 修改时间：16/7/7 15:56
 * 版 本：v1.0
 */
public class AppNotify {
    public interface NotifyHandler {
        void OnNotify(String action, String param);
    }
    private static NotifyHandler handler = null;
    public static void setNotifyHandler(NotifyHandler handler) {
        AppNotify.handler = handler;
    }
    public static void notify(String action) {
        notify(action, (String) null);
    }

    public static void notify(String action, Object param) {
        notify(action, GsonUtil.getInstance().GsonString(param));
    }


    public static void notify(String action, String param) {
        MyLogger.d("本地广播：","notify: action="+action+", param="+param);
        if (handler != null) {
            handler.OnNotify(action, param);
        }
    }
}
